#include "osgi-predefined.h"
#include <string>
#include <map>


#define SID_MonitorService                 "SID_MonitorService"
#define IID_MonitorService                 "IID_MonitorService"

#define IID_MonitorFactory "IID_MonitorFactory"
#define SID_MonitorFactory "SID_MonitorFactory"


#define IID_TestMonitorService "IID_TestMonitor"
#define SID_TestMonitorService "SID_TestMonitor"

#define IID_TestMonitor1 "IID_TestMonitor1"
#define SID_TestMonitor1 "SID_TestMonitor1"

OSGI_NAMESPACE_BEGIN

typedef void* (*InvokeNotifyFun)(std::string CMD, void* context);


//monitor 解析类
OSGI_INTERFACE IMonitor
{
    virtual int MKRAPI GetCmd(char **ppCmd) = 0;

    virtual bool MKRAPI SetMonitorData(std::map<std::string, std::string>* data) = 0;

    virtual void MKRAPI Destroy() = 0;

};

struct IMonitorInvokeHandler
{
public:
    virtual void MKRAPI OnGetData(IMonitor *req, IMonitorFactory* service) = 0;

    virtual void MKRAPI OnCtrCMD(IMonitor *req, IMonitorFactory* service) = 0;
};


OSGI_INTERFACE IMonitorFactory : public IService
{
    virtual IMonitor* MKRAPI RegisterHandler(const char *bundleName, IMonitorInvokeHandler *phandle, std::map<std::string, std::string>* Data, const char *description) = 0;

    virtual int MKRAPI UnRegisterHandler(const char* bundleName) = 0;

    virtual void MKRAPI Destroy() = 0;

};

OSGI_NAMESPACE_END
